package com.jinke.uang.http;


import com.jinke.uang.bean.AuthData;
import com.jinke.uang.bean.AuthUserInfoData;
import com.jinke.uang.bean.BindedCardData;
import com.jinke.uang.bean.BorrowingData;
import com.jinke.uang.bean.CalculateData;
import com.jinke.uang.bean.CalculateMoneyData;
import com.jinke.uang.bean.CompareData;
import com.jinke.uang.bean.DictionaryItemData;
import com.jinke.uang.bean.HelpCenterData;
import com.jinke.uang.bean.IdentityData;
import com.jinke.uang.bean.LoginData;
import com.jinke.uang.bean.MoneyProductData;
import com.jinke.uang.bean.OrderItemData;
import com.jinke.uang.bean.PayCodeData;
import com.jinke.uang.bean.PersonInfo;
import com.jinke.uang.bean.RealNameInfoData;
import com.jinke.uang.bean.UpdateData;
import com.jinke.uang.bean.UserInformationData;
import com.jinke.uang.bean.VerifyData;
import com.jinke.uang.constant.ApiConstant;
import com.jinke.uang.base.BaseResponse;

import java.util.ArrayList;
import java.util.HashMap;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

public interface Api {

    String HEADER_TOKEN_KEY = "Authorization";
    String PATH = "channel";

    @POST(ApiConstant.REGISTER_QUEST)
    Observable<BaseResponse<String>> doRegisterQuest(@Body RequestBody body);

    @POST(ApiConstant.VERIFY_CODE)
    Observable<BaseResponse<String>> getVerifyCode(@Path(PATH) String channel, @Body RequestBody body);

    @POST(ApiConstant.VOICE_CODE)
    Observable<BaseResponse<String>> getVoiceCode(@Path(PATH) String channel, @Body RequestBody body);

    @POST(ApiConstant.LOGIN)//老用户登录
    Observable<BaseResponse<LoginData>> login(@Body RequestBody body);

    @POST(ApiConstant.FACEBOOK_LOGIN)//fackbook登录
    Observable<BaseResponse<LoginData>> faceBookLogin(@Path("channel") String channel, @Body RequestBody body);

    @POST(ApiConstant.GOOGLE_PLAY_UPDATE_INFO)
    Observable<BaseResponse<UpdateData>> getGooglePlayUpdateInfo(@Path(PATH) String channel,
                                                                 @Header(HEADER_TOKEN_KEY) String token,
                                                                 @Body RequestBody commonParams);

//    @POST(ApiConstant.UPDATE_INFO)
//    Observable<UpdateResponse> getUpdateInfo(@Path(PATH) String channel,
//                                             @Header(HEADER_TOKEN_KEY) String token,
//                                             @Body RequestBody commonParams);

//    @POST(ApiConstant.MONEY_PROGRESS)
//        //全部不可选中
//    //Observable<ProgressResponse> getMoneyProgress(@Path(PATH) String channel, @Body RequestBody body);
//    Observable<ProgressResponse> getMoneyProgress(@Path("channel") String channel, @Header
//            (HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    /**
     * 获取产品等级
     * @param channel
     * @param header
     * @param body
     * @return
     */
    @POST(ApiConstant.GET_PRODUCT)
    Observable<BaseResponse<ArrayList<MoneyProductData>>> getProduct(@Path("channel") String channel, @Header
            (HEADER_TOKEN_KEY) String header, @Body RequestBody body);


    /**
     * 计算订单接口
     */
    @POST(ApiConstant.CALCULATE_DATA)
    Observable<BaseResponse<CalculateData>> getCalculateData( @Header(HEADER_TOKEN_KEY) String header,
                                                    @Body RequestBody body);

    @POST(ApiConstant.VERIFY_DATA_STATUS)
    Observable<BaseResponse<VerifyData>> getVerifyDataStatus(@Path(PATH) String channel,
                                                             @Header(HEADER_TOKEN_KEY) String header,
                                                             @Body RequestBody body);

    @POST(ApiConstant.REAL_NAME_AUTH_INFO)
    Observable<BaseResponse<RealNameInfoData>> getRealNameAuthInfo(@Path(PATH) String channel,
                                                                   @Header(HEADER_TOKEN_KEY) String header,
                                                                   @Body RequestBody body);

//    @POST(ApiConstant.IMS_LIST)
//    Observable<ImgsListResponse> getImsList(@Path(PATH) String channel,
//                                            @Header(HEADER_TOKEN_KEY) String header,
//                                            @Body RequestBody body);

    @POST(ApiConstant.DICTIONARY_DATA)
    Observable<BaseResponse<ArrayList<DictionaryItemData>>> getDictionaryData(@Path(PATH) String channel,
                                                                              @Header(HEADER_TOKEN_KEY) String header,
                                                                              @Body RequestBody body);

//    /**
//     * 获取绑卡信息
//     */
//    @POST(ApiConstant.BINDED_CARD_INFO)
//    Observable<BankCardResponse> getBindedCardInfo(@Path(PATH) String channel,
//                                                   @Header(HEADER_TOKEN_KEY) String header,
//                                                   @Body RequestBody body);

    @PUT(ApiConstant.UPDATE_BANK_CARD_INFO)
    Observable<BaseResponse<String>> updateBankCardInfo(@Path(PATH) String channel,
                                                 @Header(HEADER_TOKEN_KEY) String header,
                                                 @Body RequestBody body);

//    @POST(ApiConstant.UPLOAD_ORDER_INFO_DATA)
//    Observable<BlankResponse> uploadOrderInfoData(@Path(PATH) String channel,
//                                                  @Header(HEADER_TOKEN_KEY) String header,
//                                                  @Body RequestBody body);

//    @POST(ApiConstant.UPLOAD_MSG)
//    Observable<BlankResponse> uploadMsg(@Path(PATH) String channel,
//                                        @Header(HEADER_TOKEN_KEY) String token,
//                                        @Body RequestBody commonParams);
//
//    @POST(ApiConstant.UPLOAD_CONTACTD_LIST)
//    Observable<BlankResponse> uploadContactdList(@Path(PATH) String channel,
//                                                 @Header(HEADER_TOKEN_KEY) String token,
//                                                 @Body RequestBody commonParams);
//
//    @POST(ApiConstant.UPLOAD_CALL_RECORD_LIST)
//    Observable<BlankResponse> uploadCallRecordList(@Path(PATH) String channel,
//                                                   @Header(HEADER_TOKEN_KEY) String token,
//                                                   @Body RequestBody commonParams);
//
//    @GET(ApiConstant.UPLOAD_STATUS)
//    Observable<UploadStatusResponse> getUploadStatus(@Path("channel") String channel,
//                                                     @Header(HEADER_TOKEN_KEY) String token);
//    @GET(ApiConstant.AUTH_CHECK_STATUS)
//    Observable<UploadStatusResponse> getAuthCheckStatus(@Path("channel") String channel,
//                                                        @Header(HEADER_TOKEN_KEY) String token);
//
//    @POST(ApiConstant.SECOND_COUNT_DOWN_ORDER)
//    Observable<LastLoanResponse> getSecondCountDownOrder(@Path(PATH) String channel,
//                                                         @Header(HEADER_TOKEN_KEY) String token,
//                                                         @Body RequestBody commonParams);

    @POST(ApiConstant.ORDER_DATA2)
    Observable<BaseResponse<BorrowingData>> getOrderData2(@Path(PATH) String channel,
                                                          @Header(HEADER_TOKEN_KEY) String token,
                                                          @Body RequestBody commonParams);

    @POST(ApiConstant.PAY_CODE_DATA)
    Observable<BaseResponse<PayCodeData>> getPayCodeData(@Path(PATH) String channel,
                                                         @Header(HEADER_TOKEN_KEY) String token,
                                                         @Body RequestBody commonParams);

    @POST(ApiConstant.ROLLOVER_PAY_CODE_DATA)
    Observable<BaseResponse<PayCodeData>> getRolloverPayCodeData(@Path(PATH) String channel,
                                                       @Header(HEADER_TOKEN_KEY) String token,
                                                       @Body RequestBody commonParams);

    @POST(ApiConstant.HELP_CENTER)
    Observable<BaseResponse<ArrayList<HelpCenterData>>> getHelpCenter(@Path(PATH) String channel,
                                                                      @Header(HEADER_TOKEN_KEY) String token,
                                                                      @Body RequestBody body);

    @POST(ApiConstant.UPLOAD_LOCATION_REGISTER)
    Observable<BaseResponse<String>> uploadLocationRegister(@Path(PATH) String channel,
                                                     @Header(HEADER_TOKEN_KEY) String token,
                                                     @Body RequestBody commonParams);

//    @POST(ApiConstant.USER_INFORMATION)
//    Observable<UserInformationResponse> getUserInformation(@Path(PATH) String channel,
//                                                           @Header(HEADER_TOKEN_KEY) String header,
//                                                           @Body RequestBody body);
//
//    @PUT(ApiConstant.SAVE_USER_INFORMATION)
//    Observable<BlankResponse> saveUserInformation(@Path(PATH) String channel,
//                                                  @Header(HEADER_TOKEN_KEY) String header,
//                                                  @Body RequestBody body);

    @POST(ApiConstant.CALCULATED_ROLL_OVER_DATA)
    Observable<BaseResponse<CalculateMoneyData>> getCalculatedRollOverData(@Path("channel") String channel,
                                                                           @Header(HEADER_TOKEN_KEY) String token,
                                                                           @Body RequestBody commonParams);

//    @POST(ApiConstant.UPLOAD_PERSONAL_INFO)
//    Observable<BlankResponse> uploadPersonalInfo(@Path(PATH) String channel,
//                                                 @Header(HEADER_TOKEN_KEY) String token,
//                                                 @Body RequestBody commonParams);


    @POST(ApiConstant.APP_INSTALL)
    Observable<BaseResponse<String>> appInstall(@Body RequestBody commonParams);

//    /**
//     *获取公告
//     */
//    @POST(ApiConstant.NOTICE_CHANNEL)
//    Observable<NoticeResponse> getNotice(@Path("channel") String channel,
//                                         @Header(HEADER_TOKEN_KEY) String header,
//                                         @Body RequestBody body);
    /**
     * 获取认证状态
     */
    @POST(ApiConstant.AUTH_STATUS)
    Observable<BaseResponse<AuthData>> getAuthStatus(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    /**
     * 获取用户信息验证回显
     */
    @POST(ApiConstant.PERSON_INFO)
    Observable<BaseResponse<PersonInfo>> getPersonInfo(@Path(PATH) String channel,
                                                       @Header(HEADER_TOKEN_KEY) String header,
                                                       @Body RequestBody body);

    /**
     * 获取资料退回的
     */
    @POST(ApiConstant.USER_INFO_BACK)
    Observable<BaseResponse<UserInformationData>> getUserInfoBack(@Header(HEADER_TOKEN_KEY) String header,
                                                                  @Body RequestBody body);

    /**
     * 获取认证详情的
     */
    @POST(ApiConstant.AUTH_INFO_DATA)
    Observable<BaseResponse<AuthUserInfoData>> getAuthInfoData(@Header(HEADER_TOKEN_KEY) String token,
                                                               @Body RequestBody body);

    /**
     * 人脸图⽚对⽐
     */
    @POST(ApiConstant.IMG_COMPARE)
    Observable<BaseResponse<CompareData>> imgCompare(@Header(HEADER_TOKEN_KEY) String token,
                                                     @Body RequestBody commonParams);

    /**
     * 上传身份证图片信息
     */
    @Multipart
    @POST(ApiConstant.UPLOAD_IDENTITY_CARD)
    Observable<BaseResponse<IdentityData>> uploadIdentityCard(@Header(HEADER_TOKEN_KEY) String header,
                                                    @QueryMap HashMap<String, Object> map,
                                                    @Part MultipartBody.Part file);

    // 上传图片
    @Multipart
    @POST(ApiConstant.UPLOAD_SINGLE_IMG)
    Observable<BaseResponse<IdentityData>> uploadSingleImg(@Header(HEADER_TOKEN_KEY) String header,
                                                           @QueryMap HashMap<String, Object> map,
                                                           @Part MultipartBody.Part file);

    /**
     * 身份信息修改后保存
     */
    @POST(ApiConstant.SAVE_IDENTITY)
    Observable<BaseResponse<String>> saveIdentity(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    /**
     * 保存个⼈人资料料【公司信息、借款需求、个⼈人信息】
     */
    @POST(ApiConstant.SAVE_PERSONAL_AUTH)
    Observable<BaseResponse<String>> savePersonalAuth(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody body);

    /***
     * 通讯录提交认证
     */
    @POST(ApiConstant.UPLOAD_CONTACT_DATA)
    Observable<BaseResponse<String>> uploadContactData( @Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    /**
     * 获取绑定银行卡
     */
    @POST(ApiConstant.BINDED_CARD_DATA)
    Observable<BaseResponse<BindedCardData>> getBindedCardData(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    /**
     * 添加银行卡
     */
    @POST(ApiConstant.SAVE_BANK_CARD_INFO)
    Observable<BaseResponse<String>> saveBankCardInfo(@Header(HEADER_TOKEN_KEY) String header, @Body RequestBody body);

    /**
     * 其他认证的
     */
    @POST(ApiConstant.SAVE_ADD_INFORMATION)
    Observable<BaseResponse<String>> saveAddInformation(@Header(HEADER_TOKEN_KEY) String token, @Body RequestBody commonParams);

    /**
     * 根据订单类型获取数据
     */
    @POST(ApiConstant.ORDER_DATA)
    Observable<BaseResponse<ArrayList<OrderItemData>>> getOrderData(@Path(PATH) String channel,
                                                                    @Header(HEADER_TOKEN_KEY) String token,
                                                                    @Body RequestBody commonParams);

    /**
     * 判断是否可以提单的接口
     */
    @POST(ApiConstant.CHECK_ORDER_QUALIFICATIONS)
    Observable<BaseResponse<String>> checkOrderQualifications(@Path("channel") String channel,
                                                            @Header(HEADER_TOKEN_KEY) String token,
                                                            @Body RequestBody body);

    /**
     * 借款提单接口
     */
    @POST(ApiConstant.CREATE_ORDER)
    Observable<BaseResponse<String>> createOrder(@Path("channel") String channel,
                                                @Header(HEADER_TOKEN_KEY) String token,
                                                @Body RequestBody body);

    //查询包是否开启展期功能
    @POST(ApiConstant.OPEN_EXTENSION)
    Observable<BaseResponse<String>> openExtension(@Path("channel") String channel,
                                                              @Header(HEADER_TOKEN_KEY) String token,
                                                              @Body RequestBody body);


    @POST(ApiConstant.LOGIN_TYPE)
    Observable<BaseResponse<String>> loginType(@Path("channel") String channel,
                                                              @Body RequestBody body);

    @POST(ApiConstant.LOGIN_SMS_CODE)
    Observable<BaseResponse<String>> loginSms(
                                                              @Body RequestBody body);
    @POST(ApiConstant.LOGIN_SMS_LOGIN)
    Observable<BaseResponse<LoginData>> loginSmslogin(@Path("channel") String channel,
                                                              @Body RequestBody body);
}
